package com.pan.kang.constant;


import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

public enum MockTypeEnum {

    NONE("不模拟"),
    DEFAULT("默认"),
    INCREASE("递增"),
    FIXED("固定"),
    RANDOM("随机"),
    RULE("规则"),
    DICT("词库")
    ;

    @Getter
    public enum ParamsTypeEnum {
        NAME("人名"),
        CITY("城市"),
        URL("网址"),
        EMAIL("邮箱"),
        IP("IP"),
        INTEGER("整数"),
        DECIMAL("小数"),
        UNIVERSITY("大学"),
        DATE("日期"),
        TIMESTAMP("时间戳"),
        PHONE("手机号"),
        ANIMAL("动物"),
        FOOD("食物"),

        ;

        private final String value;

        ParamsTypeEnum(String value) {
            this.value = value;
        }
    }

    @Getter
    private final String value;

    MockTypeEnum(String value) {
        this.value = value;
    }

    public static ParamsTypeEnum getParamsTypeByValue(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (ParamsTypeEnum paramsTypeEnum : ParamsTypeEnum.values()) {
            if (paramsTypeEnum.value.equals(value)) {
                return paramsTypeEnum;
            }
        }
        return null;
    }

    public static MockTypeEnum getMockTypeByValue(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (MockTypeEnum mockTypeEnum : MockTypeEnum.values()) {
            if (mockTypeEnum.value.equals(value)) {
                return mockTypeEnum;
            }
        }
        return null;
    }


}
